<?php
class BookController extends BaseController {
    private $article_model;

    public function add() {
        return array(
            'tpl' => 'book/add',
        );
    }

    public function addSubmit() {
        $book_model = new BookModel();
        $input = $this->getInput('post');
        $book_model->add($input);
        return array(
            'tpl' => 'book/add_submit',
        );
    }

    public function index() {
//        if(!isset($_COOKIE['is_allowed']) || $_COOKIE['is_allowed'] != 1) {
//            return array(
//                'jump' => true,
//                'uri' => '/',
//                'code' => '302',
//            );
//        }
        $book_model = new BookModel();
        $input = $this->getInput('get');
        $data = $book_model->getList($input);

        return array(
            'tpl' => 'book/index',
            'data' => array(
                'books' => $data,
            ),
        );
    }
}
?>
